/**
 * camera.h
 *
 * Header file for utility.c, server.c, and client.c  Provides function
 * headers and preprocessor directives
 *
 * @author Team Wire-Lettuce
 * @date 12 April 2011
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <signal.h>
#include <stddef.h>

#ifndef _CAMERA_H
#define _CAMERA_H


#define ERROR -1
#define SUCCESS 1
#define TRUE 0
#define FALSE 1
#define PORT "8080" // the port client will be connecting to
#define BACKLOG 10
#define NUM_CHUNKS 1 // number of chunks of size NUM_BYTES to write
#define NUM_BYTES 4000 // size of chunk to write
#define BUF_SIZE 4050 // size of the buffer to store the picture

/* In utility.c */
int resetCamera();
int waitInit();
int takePicture();
int readFileSize();
int readPicture(char* picBuf, int size);
int stopTakingPictures();
void byteTx(char* buffer);
int openPort();
int closePort();
int byteRx(char* buffer);
int rxPic(char* buffer, int size);
int sizeOfArray(char* buffer);

/* In server.c */
int createListener(const char * name);
void *get_in_addr(struct sockaddr *sa);
void sigchld_handler(int s);

/* In client.c */
void *get_in_addr(struct sockaddr *sa);


#endif
